package com.hulizuofang.wol.chat.client.action;

import java.io.Serializable;

import com.gwtplatform.dispatch.shared.UnsecuredActionImpl;
import com.hulizuofang.wol.chat.client.data.ChatUser;

public class SendChatAction extends UnsecuredActionImpl<SendChatResult> implements Serializable {
	private static final long serialVersionUID = 1L;
	private ChatUser sender;
	private ChatUser recipient;
	private String message;
	
	protected SendChatAction() {}
	
	public SendChatAction(ChatUser sender, ChatUser recipient, String message) {
		super();
		this.sender = sender;
		this.recipient = recipient;
		this.message = message;
	}


	public interface ChatWorker<X> {
		X work(ChatUser sender, ChatUser recipient, String message);
	}

	public <X> X workChat(ChatWorker<X> chatWorker) {
		return chatWorker.work(sender, recipient, message);
	}
}
